<template>
  <div>
    <div class="row wrapper border-bottom white-bg page-heading">
      <div class="col-sm-4">
        <h2>文件</h2>
        <ol class="breadcrumb">
          <li>
            <router-link :to="{ name: 'home' }">
              主页
            </router-link>
          </li>
          <li>
            <router-link :to="{ name: 'productList' }">
              项目列表
            </router-link>
          </li>
          <li>
            <router-link :to="{ name: 'product', params: { productId: $route.params.productId } }">
              文件
            </router-link>
          </li>
          <li class="active">
            <strong>历史版本</strong>
          </li>
        </ol>
      </div>
    </div>
    <div class="wrapper wrapper-content  animated fadeInUp">

        <div class="ibox">
          <div class="ibox-title">
              <h5>文件履历</h5>
              <div class="ibox-tools">
              </div>
          </div>
          <div class="ibox-content">
            <table class="table">
              <thead>
                <tr>
                    <th></th>
                    <th>文件名称</th>
                    <th>描述</th>
                    <th>权限</th>
                    <th>状态</th>
                    <th>更新者</th>
                    <th>更新时间</th>
                    <th>创建者</th>

                </tr>
                </thead>
                <tbody>
                <tr v-for="(item, index) in fileHistoryList">
                    <td>{{ index + 1 }}</td>
                    <td>
                      <a :href="'/file/download.do?fileName=' + item.filename + '&type=1'" class="text-navy" style="word-break:break-all;">
                        {{ item.filenameshow }}
                      </a>
                    </td>
                    <td>{{ item.filedescription }}</td>
                    <td>{{ config.ProductPermissionsList[item.filepermissions] }}</td>
                    <td>{{ config.fileStatus[item.status] }}</td>
                    <td>{{ item.username }}</td>
                    <td>{{ common.dateFormat("yyyy-MM-dd hh:mm:ss", item.updateTime) }}</td>
                    <td>{{ item.username }}</td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
    </div>
  </div>

</template>

<script>
import server from '@/server/server.js'
import cookie from '@/server/cookie.js'
import common from '@/server/common.js'
import $ from 'jquery'
export default {
  name: 'product',
  data () {
    return {
      common: common,
      userId: '',
      fileHistoryList: []
    }
  },
  created () {

  },
  mounted () {
    // 获取历史文件
    const vue = this
    vue.userId = cookie.getCookie('id')
    const params = "productId=" + vue.$route.params.productId + "&fileId=" + vue.$route.params.fileId
    server.get(server.getFileHistoryListUrl, null, params, true, false, this, function(data) {
      vue.fileHistoryList = data;
    })

  },
  methods: {
  }
}
</script>

<style scoped>
.file-list {
  border-bottom: 1px solid #eeeeee;
  padding-bottom: 15px;
  padding-top: 5px;
}

.margin-top-5px {
  margin-top: 5px;
}
</style>
